import maths.Matrix;
import maths.Misc;
import std.c.math:tanf;

import std.stdio:writefln;

/* http://pyopengl.sourceforge.net/documentation/manual/gluPerspective.3G.html */
mat4 projectionMatrix(float fovy, float aspect, float zNear, float zFar){
	mat4 per;
	

	per[0] = 1/(tanf(deg2rad*fovy/2)*aspect);
	per[5] = 1/tanf(deg2rad*fovy/2);
	per[10] = (zNear + zFar)/(zNear - zFar);
	per[11] = -1;
	per[14] = (- 2 * zNear * zFar)/(zNear - zFar);//TODO: "-" from matrix4 Nvidia NatureScene
	per[1] = per[2] = per[3] = per[4] = per[6] = per[7] = per[8] = per[9] = per[12] = per[13] = per[15] = 0;
	return per;
}
